<template>
  <div class="vmpanel">
    <span class="light"></span><span class="light"></span
    ><span class="light"></span><span class="light"></span>
    <div class="panelcontent">
      <slot name="panelcontent">
        <h2>每个小面板名字</h2>
        <div class="chart"></div>
      </slot>
    </div>
    <div class="panelfooter"></div>
  </div>
</template>

<script>
// 思路：1.每个小面板几乎一致，可定义成一个公共组件VmPanel 2.小面板里内容数据不一样，可用slot插槽实现(内容包括：每个面板名字,每个面板高度) 3.外面调用该插槽时，可传入不同名字，不同高度这样就保持了内容的不一致

export default {
  name: 'vmpanel',
}
</script>
<style scoped lang="scss">
.vmpanel {
  position: relative;
  height: 300px;
  border: 1px solid rgba(25, 186, 139, 0.17);
  background: url('../assets/img/b.png');
  padding: 0 15px 40px;
  margin-bottom: 15px;
  box-sizing: border-box;
}

.vmpanel:before {
  position: absolute;
  top: 0;
  left: 0;
  content: '';
  width: 10px;
  height: 10px;
  border-top: 2px solid #02a6b5;
  border-left: 2px solid #02a6b5;
}

.vmpanel:after {
  position: absolute;
  top: 0;
  right: 0;
  content: '';
  width: 10px;
  height: 10px;
  border-top: 2px solid #02a6b5;
  border-right: 2px solid #02a6b5;
}

.vmpanel .panelfooter {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
}

.vmpanel .panelfooter:before {
  position: absolute;
  bottom: 0;
  left: 0;
  content: '';
  width: 10px;
  height: 10px;
  border-bottom: 2px solid #02a6b5;
  border-left: 2px solid #02a6b5;
}

.vmpanel .panelfooter:after {
  position: absolute;
  bottom: 0;
  right: 0;
  content: '';
  width: 10px;
  height: 10px;
  border-bottom: 2px solid #02a6b5;
  border-right: 2px solid #02a6b5;
}

.panelcontent h2 {
  height: 48px;
  line-height: 48px;
  color: white;
  font-size: 20px;
  text-align: center;
  font-weight: 400;
}

.panelcontent .chart {
  height: 240px;
  /* background-color: pink; */
}
.vmpanel {
  overflow: hidden;
  .light {
    position: absolute;
    display: block;
  }
  .light:nth-child(1) {
    filter: hue-rotate(0deg);
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #3a86ff);
    animation: animate1 0.00009s linear infinite;
  }

  @keyframes animate1 {
    0% {
      left: -100%;
    }

    50%,
    100% {
      left: 100%;
    }
  }
  .light:nth-child(2) {
    filter: hue-rotate(60deg);
    top: -100%;
    right: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, transparent, #3a86ff);
    animation: animate2 0.00009s linear infinite;
    animation-delay: 2s;
  }

  @keyframes animate2 {
    0% {
      top: -100%;
    }

    50%,
    100% {
      top: 100%;
    }
  }
  .light:nth-child(3) {
    filter: hue-rotate(120deg);
    bottom: 0;
    right: 0;
    width: 100%;
    background: linear-gradient(270deg, transparent, #3a86ff);
    animation: animate3 0.00009s linear infinite;
    animation-delay: 4s;
  }

  @keyframes animate3 {
    0% {
      right: -100%;
      height: 3px;
    }

    50%,
    100% {
      height: 2px;
      right: 100%;
    }
  }
  .light:nth-child(4) {
    filter: hue-rotate(300deg);
    bottom: -100%;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(360deg, transparent, #3a86ff);
    animation: animate40.00009s linear infinite;
    animation-delay: 6s;
  }

  @keyframes animate4 {
    0% {
      bottom: -100%;
    }

    50%,
    100% {
      bottom: 100%;
    }
  }
}
</style>
